home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
ctlib100.zip
/
INSTALL.LZH
/
CTTABLES.INT
< prev
next >
Wrap
Text File
|
1996-10-12
|
4KB
|
106 lines
{**************************************************************************}
{* BitSoft Development, L.L.C. *}
{* Copyright (C) 1995, 1996 BitSoft Development, L.L.C. *}
{* All rights reserved. *}
{* Table structures unit *}
{* Version 2.4.2 *}
{**************************************************************************}
unit ctTables;
{$X+}
interface
uses Objects,
{$ifdef Ver60} BsdVer60, {$endif Ver60}
Containr, ctTypes, ctFields;
type
PTable = ^TTable;
TTable = object(TSequence)
Stream : PStream;
StartPos : LongInt;
Structure : PFieldStructure;
RowSize : Word;
DeletedRows : LongInt;
HeaderSize : Word;
IsDeleted : Boolean;
constructor Init (AStructure : PFieldStructure; AStream : PStream);
constructor Open (AStream : PStream);
destructor Done; virtual;
function ActiveRows : LongInt;
function At (Index : LongInt) : Pointer; virtual;
function AtDelete (Index : LongInt) : Boolean; virtual;
function AtField (Index : LongInt; AField : Integer; MaxLen : Word;
P : PChar) : Boolean; virtual;
function AtFree (Index : LongInt) : Boolean; virtual;
function AtInsert (Index : LongInt; Item : Pointer) : Boolean; virtual;
function AtItem (Index : LongInt; Offset : Word; MaxLen : Word;
P : PChar) : Boolean;
function AtPut (Index : LongInt; Item : Pointer) : Boolean; virtual;
function AtPutField (Index : LongInt; AField : Integer; Len : Word;
P : PChar) : Boolean; virtual;
function AtPutItem (Index : LongInt; Offset : Word; Len : Word;
P : PChar) : Boolean; virtual;
function AtUnDelete (Index : LongInt) : Boolean; virtual;
function CalcHeaderSize : LongInt; virtual;
function DeleteAll : Boolean; virtual;
procedure DoneItem(Item : Pointer); virtual;
function FieldOffset (AField : LongInt) : Word; virtual;
function ForEach (Action : Pointer) : Boolean; virtual;
function ForEachThat (Test, Action : Pointer) : Boolean; virtual;
function FreeAll : Boolean; virtual;
procedure FreeItem (Item : Pointer); virtual;
function GetItem (var S : TStream) : Pointer; virtual;
function IndexOf (Item : Pointer) : LongInt; virtual;
function Pack : Boolean; virtual;
procedure PutItem (var S : TStream; Item : Pointer); virtual;
procedure ReadHeader; virtual;
procedure ReadStructure; virtual;
procedure Reset; virtual;
function RowOffset (Index : LongInt) : LongInt; virtual;
function Search (Key : Pointer; var Index : LongInt) : Boolean; virtual;
procedure Seek (Index : LongInt); virtual;
procedure ShowInfo (var Device : Text); virtual;
function UnDelete (Index : LongInt) : Boolean; virtual;
function ValidFieldStructure (AStructure : PFieldStructure) : Boolean;
virtual;
function ValidStream (AStream : PStream) : Boolean; virtual;
procedure WriteHeader; virtual;
procedure WriteStructure; virtual;
function Zap : Boolean; virtual;
private
procedure WriteItem (Index : LongInt; Item : Pointer);
end; { TTable }
type
PObjectTable = ^TObjectTable;
TObjectTable = object(TTable)
function CalcHeaderSize : LongInt; virtual;
procedure FreeItem (Item : Pointer); virtual;
function GetItem (var S : TStream) : Pointer; virtual;
procedure PutItem (var S : TStream; Item : Pointer); virtual;
procedure ReadHeader; virtual;
function RowOffset (Index : LongInt) : LongInt; virtual;
procedure WriteHeader; virtual;
end; { TObjectTable }
const
TableSig : array[0..3] of Char = 'DBMS';
TableVersion : Word = $0100;
ObjectTableSig : array[0..4] of Char = 'ODBMS';
ObjectTableVersion : Word = $0100;
ActiveRow : Char = ' ';
DeletedRow : Char = '*';
EOF : Byte = $1A;
implementation
end.